FROM node:16-alpine AS dev
RUN apk add bash
# 定位到容器工作目录
WORKDIR /app
COPY . .
RUN yarn && yarn build

FROM node:16-alpine AS prod
LABEL author="linjielinlin" \
description="desc"
RUN apk add bash
# 定位到容器工作目录
WORKDIR /app
COPY ./package*.json .
COPY ./*.lock .
COPY ./.env .
COPY --from=dev /app/dist ./dist

EXPOSE 3000
CMD bash -c "yarn && yarn start:prod"
